﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.U2D.SpriteAtlas
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System.Runtime.CompilerServices;
using UnityEngine.Bindings;

#nullable disable
namespace UnityEngine.U2D
{
  /// <summary>
  ///   <para>Sprite Atlas is an asset created within Unity. It is part of the built-in sprite packing solution.</para>
  /// </summary>
  [NativeHeader("Runtime/Graphics/SpriteFrame.h")]
  [NativeType(Header = "Runtime/2D/SpriteAtlas/SpriteAtlas.h")]
  public class SpriteAtlas : Object
  {
    public SpriteAtlas() => SpriteAtlas.Internal_Create(this);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void Internal_Create([Writable] SpriteAtlas self);

    /// <summary>
    ///   <para>Return true if this SpriteAtlas is a variant.</para>
    /// </summary>
    public extern bool isVariant { [NativeMethod("IsVariant"), MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>Get the tag of this SpriteAtlas.</para>
    /// </summary>
    public extern string tag { [MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>Get the total number of Sprite packed into this atlas.</para>
    /// </summary>
    public extern int spriteCount { [MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>Return true if Sprite is packed into this SpriteAtlas.</para>
    /// </summary>
    /// <param name="sprite"></param>
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern bool CanBindTo([NotNull("ArgumentNullException")] Sprite sprite);

    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern bool IsPlaceholder();

    /// <summary>
    ///   <para>Clone the first Sprite in this atlas that matches the name packed in this atlas and return it.</para>
    /// </summary>
    /// <param name="name">The name of the Sprite.</param>
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern Sprite GetSprite(string name);

    /// <summary>
    ///   <para>Clone all the Sprite in this atlas and fill them into the supplied array.</para>
    /// </summary>
    /// <param name="sprites">Array of Sprite that will be filled.</param>
    /// <returns>
    ///   <para>The size of the returned array.</para>
    /// </returns>
    public int GetSprites(Sprite[] sprites) => this.GetSpritesScripting(sprites);

    /// <summary>
    ///   <para>Clone all the Sprite matching the name in this atlas and fill them into the supplied array.</para>
    /// </summary>
    /// <param name="sprites">Array of Sprite that will be filled.</param>
    /// <param name="name">The name of the Sprite.</param>
    public int GetSprites(Sprite[] sprites, string name)
    {
      return this.GetSpritesWithNameScripting(sprites, name);
    }

    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern int GetSpritesScripting([Unmarshalled] Sprite[] sprites);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern int GetSpritesWithNameScripting([Unmarshalled] Sprite[] sprites, string name);
  }
}
